package com.example.shop.controller;

import com.example.shop.mapper.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

@Controller
@RequestMapping("/vx")
public class VxManController {
    @Autowired
    CollectMapper collectMapper;
    @Autowired
    CommentMapper commentMapper;
    @Autowired
    FollowMapper followMapper;
    @Autowired
    InfoMapper infoMapper;
    @Autowired
    OrderMapper orderMapper;

    @RequestMapping("/order")
    public String vxOrder(HttpServletRequest req){ //后端请求全部的订单列表
        req.setAttribute("orderList",orderMapper.orderList2());
        return "/vx/order";
    }

    @RequestMapping("/comment")
    public String vxComment(HttpServletRequest req){ //查询视图中的data
        req.setAttribute("commentList",commentMapper.listComment2());
        return "/vx/comment";
    }

    @RequestMapping("/info")
    public String vxInfo(HttpServletRequest req){ //管理员页面显示求购信息
        req.setAttribute("infoList",infoMapper.infoList());
        return "/vx/info";
    }


    @RequestMapping("/collect")
    public String vxCollect(HttpServletRequest req){ //查询视图中的data
        req.setAttribute("collectList",collectMapper.collectList2());
        return "/vx/collect";
    }

    @RequestMapping("/follow")
    public String vxFollow(HttpServletRequest req){ //查询视图中的data
        req.setAttribute("followList",followMapper.followList2());
        return "/vx/follow";
    }
}
